package sfeir.ergosum.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * used to agregate contacts in differents groups ordered each others.
 * @author weber.a
 *
 */
public class Group implements Serializable {
    private static final long serialVersionUID = 1L;

    private long id;

    private List<Contact> contacts;
    private String name;
    private int order;

    public Group() {
        super();
    }
    
    public Group(String name) {
        super();
        this.name = name == null?name:name.trim();
        this.contacts = new ArrayList<Contact>();
    }

    public Group(int order, String name) {
        super();
        this.name = name == null?name:name.trim();
        this.order = order;
        this.contacts = new ArrayList<Contact>();
    }
    
    public Group(int id, int order, String name) {
        super();
        this.id = id;
        this.name = name == null?name:name.trim();
        this.order = order;
        this.contacts = new ArrayList<Contact>();
    }
    
    public List<Contact> getContacts() {
        return contacts;
    }
    public void setContacts(List<Contact> contacts) {
        this.contacts = contacts;
    }
    public void addContact(Contact contact) {
        contacts.add(contact);
    }
    public void removeContact(Contact contact) {
        contacts.remove(contact);
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name == null?name:name.trim();
    }
    public int getOrder() {
        return order;
    }
    public void setOrder(int order) {
        this.order = order;
    }
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    public String toString() {
        return name;
    }
}
